package pl.edu.mimuw.irs.rcp.controller.editor.roles.command;

import org.eclipse.gef.commands.Command;

import pl.edu.mimuw.irs.core.model.design.resource.Role;
import pl.edu.mimuw.irs.rcp.persistence.PersistenceManager;

public class DeleteRoleCommand extends Command {

	// *** Attributes

	private Role role;
	private PersistenceManager manager;
	
	// *** Constructors

	public DeleteRoleCommand(Role role, PersistenceManager manager) {
		this.role = role;
		this.manager = manager;
	}

	// *** Methods
	
	@Override
	public void execute() {
		manager.getRoles().remove(role);
		super.execute();
	}
	
	@Override
	public void undo() {
		manager.getRoles().add(role);
		super.undo();
	}
}
